package admin;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class Setblog {
	public String setdata(String author,String title,String time,String describe,String cover,String blogdata) {
		try {
			Class.forName("com.mysql.jdbc.Driver");
			Getconfig gc=new Getconfig();
			String url= gc.getParaValue("connectUrl");
			Connection conn=DriverManager.getConnection(url);
			String sql="insert into blogdata(blogtitle,blogdescribe,blogauthor,starttime,blogcoverurl,blogdata) value(?,?,?,?,?,?)";
			PreparedStatement ps=conn.prepareStatement(sql);
			ps.setString(1, title);
			ps.setString(2, describe);
			ps.setString(3, author);
			ps.setString(4, time);
			ps.setString(5, cover);
			ps.setString(6, blogdata);
			ps.executeUpdate();
			ps.close();
			conn.close();
			return "添加成功";
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			return "添加失败";
		}
	}
}
